class CreateHolders < ActiveRecord::Migration
  def self.up
    create_table :holders do |t|
      t.column :lock_version,  :integer,   :null  => false
      t.column :type,          :string,    :null  => false, :limit   => 8
      t.column :name,          :string,    :null  => false, :limit   => 40
      t.column :description,   :string,    :limit => 40
      t.column :weblog_id,     :integer,   :null  => false
      t.column :entries_count, :integer,   :null  => false, :default => 0
      t.column :created_at,    :timestamp, :null  => false
      t.column :updated_at,    :timestamp, :null  => false
    end

    add_index :holders, [ :type, :name, :weblog_id ], :unique => true
  end

  def self.down
    drop_table :holders
  end
end
